import json

import requests
from fake_useragent import UserAgent



# url = "http://www.baidu.com"
# ua = UserAgent()
#
# headers = {
#     'User-Agent': ua.random,
#     'Referer': 'http://www.baidu.com'  # Referer应该放在headers中，并且通常指向同一个网站的页面
# }
# cookie = {
#     'sessionid':'lnf8fd2gylqz93mpmeq23wcl9aivsgwc',
# }
# response = requests.get(url,headers=headers,cookies= cookie)
#
# print(response.status_code)
# print(response.content.decode("utf-8"))
# response_text = response.content.decode("utf-8")
# print(response_text)

ua = UserAgent()
headers = {
    "User-Agent":ua.random,
    "referer": "http://fyx.com/news"
}
cookie = {
    # 'sessionid':'lnf8fd2gylqz93mpmeq23wcl9aivsgwc',

}

res = requests.get("http://127.0.0.1:8000/referer/",headers=headers)
print(res.text)

